<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			pre{
				font-size: 20px;
			}
		</style>
	</head>
	<body>
<pre>
	
</pre>
		<div id="box">
			
		</div>
		<script>
			/**
			 for...in用来遍历对象
			 for(var o in obj){
				 
			 }
			 * */
			var x=1;
			var y=x;
			y=10;
			console.log("x:",x,"y:",y);
			fgx();
			var arr1=["a","b","c"];
			var arr2=arr1;
			arr2.push("d");
			console.log("arr1:",arr1);
			console.log("arr2:",arr2);
			fgx();
			var obj1={
				user:"才哥",
				age:30,
				sex:1
			}
			var obj2=obj1;
			obj2.user="孙庆阳";
			console.log("obj1:",obj1);
			console.log("obj2:",obj2);
			fgx("for...in用来遍历对象");
			var obj3={};
			for(var o in obj1){
				console.log("o:",o);//o属性名/键/key
				console.log("obj1[o]:",obj1[o]);//属性值/值/value
			}
			
			
			fgx();
			;(function(){
					var obj={
						user:"尚超",
						age:31,
						sex:1
					}
					
					//方式1
					var user1=obj.user;
					console.log("user1:",user1);
					//方式2
					var user2=obj["user"];
					console.log("user2:",user2);
					//方式3
					var str="user";
					var user3=obj[str];//变量名
					console.log("user3:",user3);
					// var str2=prompt("请输入你要查询的属性(user,age,sex)","user");
					str2="user";
					var r=obj[str2];
					console.log("r:",r);
					
					
					var f=confirm("你真的要删除吗?");
					if(f){
						console.log("你真狠心啊,竟然真的删了");
					}else{
						console.log("我就知道你不会删的");
					}
					
					
			}());
			
			function fgx(str=""){
				console.log(str+"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
			}
		</script>
	</body>
</html>
